package net.blf2.mybatisplus.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.io.Serializable;

@TableName("company")
public class Company extends Model<Company>{//开启ActiveRecord模式

    @TableId(type = IdType.INPUT)
    private String companyId;//主键要用注解指定出来 不然查询的时候 where条件会是 where null=?
    @TableField("company_name")
    private String companyName;

    public String getCompanyId() {
        return companyId;
    }

    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    @Override
    public String toString() {
        return "Company{" +
                "companyId='" + companyId + '\'' +
                ", companyName='" + companyName + '\'' +
                '}';
    }

    @Override
    protected Serializable pkVal() {//开启ActiveRecord模式必须提供此方法 方法的功能为获取主键
        return this.companyId;
    }
}
